/*
-----------------------------------------------------------------------------
This file is part of NxGraphics, Multimedia Engine.
Author : Stephane Kyles. Developed in Prague, Czech Republic.
				_   __      _    __ _      __           
			   / | / /_  __| |  / /(_)____/ /___   ____ 
			  /  |/ /| |/_/| | / // // __  // _ \ / __ \
			 / /|  /_>  <  | |/ // // /_/ //  __// /_/ /
			/_/ |_//_/|_|  |___//_/ \__,_/ \___/ \____/ 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __NXVIDEOAVIMANAGER_H__
#define __NXVIDEOAVIMANAGER_H__

#include "NxVideo_Prerequisites.h"
#include "NxVideo_Player.h"
 
namespace NxVideo_Namespace {

//!  A Class Buffer Utility For NxVideo
/*!
	NxVideoBuffer Class Implementation.
*/
class NxVideo_Export NxVideoBuffer : public NxVideo_Player
{
public :
	NxVideoBuffer( int Width, int Height, int bpp );
	~NxVideoBuffer();
	BYTE * GetPixelData();
};

//!  A Video Avi Player Class Utility For NxVideo
/*!
	NxVideo_Avi_Player Class Implementation.
*/
class NxVideo_Export NxVideo_Avi_Player : public NxVideo_Player
{
public :
	NxVideo_Avi_Player();
	~NxVideo_Avi_Player();
	bool OpenVideoFile( const std::string & szFileName );
	bool CloseVideoFile();
	bool RenderFrame();
	BYTE * GetPixelData();
	bool NewFrame();
	void ResetFrame();
	void Get_Video_Codec_Info( std::string file );
	void Video_Pause_Rendering( bool value );
	bool FoundCorrectDecompressor();
	NxVideo_Info * VIDEO_GLOBAL_INFO ;
	NxVideoVFW * m_Video;
};

//!  A Video Avi Recorder Class Utility For NxVideo
/*!
	NxVideo_Avi_Recorder Class Implementation.
*/
class NxVideo_Export NxVideo_Avi_Recorder : public NxVideo_Recorder
{
public :
	NxVideo_Avi_Recorder();
	~NxVideo_Avi_Recorder();
	bool CreateVideoFile( const std::string & szFileName, int width, int height, int Bpp, int Fps );
	bool CloseVideoFile();
	void AddVideoFrame( BYTE * Buffer );
private:
	NxVideoRecorderVFW * mVideo;
};

//!  A Video Mov Player Class Utility For NxVideo
/*!
	NxVideo_Mov_Player Class Implementation.
*/
class NxVideo_Export NxVideo_Mov_Player : public NxVideo_Player
{
public :
	NxVideo_Mov_Player();
	~NxVideo_Mov_Player();
	bool OpenVideoFile( const std::string & szFileName );
	bool CloseVideoFile();
	bool RenderFrame();
	BYTE * GetPixelData();
	void SetFramerate( float framerate );
	bool NewFrame();
	void ResetFrame();

	void Play();
 
	NxVideoQuickTime * m_Video;

};

//!  A Video Swf Player Class Utility For NxVideo
/*!
	NxVideo_Flash_Reader Class Implementation.
*/
class NxVideo_Export NxVideo_Flash_Reader : public NxVideo_Player
{
public :
	NxVideo_Flash_Reader( int Width, int Height );
	~NxVideo_Flash_Reader();
	bool OpenVideoFile( const std::string & szFileName );
	bool CloseVideoFile();
	bool RenderFrame();
	BYTE * GetPixelData();
	void SetFramerate( float framerate );
	void Play();
	void Pause();
	void Stop();
	void CallFunction( std::string theName, std::string theValue );
	void SetVariable( std::string theName, std::string theValue );
	NxVideoFlashSwf * mVideo;

};

//!  A Video Flv Player Class Utility For NxVideo
/*!
	NxVideo_FLV_Reader Class Implementation.
*/
class NxVideo_Export NxVideo_FLV_Reader : public NxVideo_Player
{
public :
	NxVideo_FLV_Reader( int Width, int Height );
	~NxVideo_FLV_Reader();
	bool OpenVideoFile( const std::string & szFileName );
	bool CloseVideoFile();
	bool RenderFrame();
	BYTE * GetPixelData();
	void SetFramerate( float framerate );
	void Play();
	void Pause();
	void Stop();
private:
	NxVideoFlashFlv * mVideo;
};

//!  A Video Web Player Class Utility For NxVideo
/*!
	NxVideo_URL Class Implementation.
*/
class NxVideo_Export NxVideo_URL : public NxVideo_Player
{
public :
	NxVideo_URL( int Width, int Height );
	~NxVideo_URL();
	bool OpenVideoFile( const std::string & szFileName );
	bool CloseVideoFile();
	bool RenderFrame();
	BYTE * GetPixelData();
	NxVideo_URLCallback * UrlCallBack ;
	Berkelium::Context * context ;
	Berkelium::Window * win;
};

//!  A Video Jpeg Stream Player Class Utility For NxVideo
/*!
	NxVideoStream Class Implementation.
*/
class NxVideo_Export NxVideoStream : public NxVideo_Player
{
public :
	NxVideoStream();
	~NxVideoStream();
	bool OpenVideoFile( const std::string & szFileName );
	bool CloseVideoFile();
	bool RenderFrame();
	BYTE * GetPixelData();
	bool NewFrame();
	void ResetFrame();
	bool StartReceiving( int Port, int Width, int Height );
	unsigned int GetIndex();
	void SetIndex( unsigned int ValidIndex );
	SocketInfo * Info;
	unsigned int Index;

};



} 

#endif
